package fr.umlv.android.boggle;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

/**
 * Represents the activity when the application starts.
 * 
 * @author Jenseric Catbagan
 * @author Olivier Chantefoin
 *
 */
public class Boggle extends Activity {
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.game_menu);
        
     
        //initService();
        initActionButtons();
        
    }
    
	/**
     * Initializes the actions buttons which are in the activity.
     */
    private void initActionButtons() {
    	final Button button = (Button) findViewById(R.id.startButton);
    	initActionButton(button, new Intent(this, GameActivity.class));
    	
    	final Button button2 = (Button) findViewById(R.id.scoreButton);
    	initActionButton(button2, new Intent(this, ScoreActivity.class));
    	
    	
    	final Button button3 = (Button) findViewById(R.id.optionsButton);
    	initActionButton(button3, new Intent(this, GameEndedActivity.class));
    	

    }

    /**
     * Associates an action of a button to an another activity.
     */
	private void initActionButton(final Button button, final Intent intent) {

        button.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				startActivity(intent);
			}
		});
	}

}